/** @file unittest1.c
*   @brief Unit test for the getCost() function in dominion.c
*   @author Stephen Dunbar
*   CS362 Assignment 3
*/

#include "dominion.h"
#include "dominion_helpers.h"
#include <assert.h>
#include <stdio.h>
#include <limits.h>

int main(int argc, char **argv )
{

    printf("Running tests for getCost().\n");

    // Card costs
    const int costs[] =
    {
        [curse]        = 0,
        [estate]       = 2,
        [duchy]        = 5,
        [province]     = 8,
        [copper]       = 0,
        [silver]       = 3,
        [gold]         = 6,
        [adventurer]   = 6,
        [council_room] = 5,
        [feast]        = 4,
        [gardens]      = 4,
        [mine]         = 5,
        [remodel]      = 4,
        [smithy]       = 4,
        [village]      = 3,
        [baron]        = 4,
        [great_hall]   = 3,
        [minion]       = 5,
        [steward]      = 3,
        [tribute]      = 5,
        [ambassador]   = 3,
        [cutpurse]     = 4,
        [embargo]      = 2,
        [outpost]      = 5,
        [salvager]     = 4,
        [sea_hag]      = 4,
        [treasure_map] = 4
    };


    // check that card costs from getCost() match costs defined in costs[]
    for (int c = curse; c <= treasure_map; c++) {
    	assert(costs[c] == getCost(c));
    }

    // check that getCosts() returns -1 for invalid cards
    assert(getCost(curse - 1) == -1);
    assert(getCost(treasure_map + 1) == -1);
    assert(getCost(INT_MIN) == -1);
    assert(getCost(INT_MAX) == -1);

printf("Tests for getCosts() passed.\n");

}
